﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zhaoxi.AdvancedCourse.Models;

namespace Zhaoxi.AdvancedCourse.GenericClasses
{
    //泛型类   引用类型约束：where T:class
    public class RecordList<T> where T : class
    {
        //存储记录列表
        List<T> list = new List<T>();
        //添加记录
        public void Add(T record)
        {
            list.Add(record);
        }
        //删除指定记录
        public void Delete(T record)
        {
            list.Remove(record);
        }
        //获取收入记录数
        public int GetCount()
        {
            return list.Count;
        }
    }
}
